<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:mias="http://www.monsters.inc/mias">
<!-- 
     Everything outside the ui:composition tag will be ignored by Facelets!
-->
<ui:composition>
  <!--
       If no headerColSpan value is defined, the default value will
       be 1, which means no column spanning. 
  -->
  <c:if test="#{empty headerColSpan}">
    <c:set var="headerColSpan" value="1" />
  </c:if>

  <!--
       If no explicit header name is set, the columnName will be used
       to lookup the header name in the message bundle. Otherwise, the
       value set in headerName will be used to lookup the header text
       in the message bundle. It is not possible to use a literal text
       that is not in the message bundle.  
  -->
  <c:if test="#{empty headerName}" sortPropertyName="#{columnName}">
    <c:set var="headerName" value="#{columnName}" />
  </c:if>

  <t:column headercolspan="#{headerColSpan}" id="#{columnName}" 
            sortable="#{sortable}" groupBy="#{groupBy}">
    <f:facet name="header">
      <c:choose>
        <c:when test="#{sortable}">
          <t:commandSortHeader columnName="#{columnName}" arrow="false" 
                               propertyName="#{columnName}">
            <h:outputText value="#{msg[headerName]}" />
            <f:facet name="ascending">
              <t:graphicImage value="../images/up.png" border="0" />
            </f:facet>
            <f:facet name="descending">
              <t:graphicImage value="../images/down.png" border="0" />
            </f:facet>
          </t:commandSortHeader>
        </c:when>
        <c:otherwise>
          <h:outputText value="#{msg[headerName]}" />
        </c:otherwise>  
      </c:choose>
    </f:facet>
    
    <c:choose>
      <c:when test="#{custom}">
        <ui:insert />
      </c:when>
      <c:otherwise>
	    <h:outputText value="#{bean[columnName]}">
	      <ui:insert />
	    </h:outputText>
      </c:otherwise>
    </c:choose>
  </t:column>
</ui:composition>
</html>
